<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="language" content="en"/>

    <!-- blueprint CSS framework -->
    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/screen.css"
          media="screen, projection"/>
    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/print.css"
          media="print"/>
    <!--[if lt IE 8]>
    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/ie.css"
          media="screen, projection"/>
    <![endif]-->

    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/main.css"/>
    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/form.css"/>
    <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->baseUrl; ?>/css/menu.css"/>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"
            charset="utf-8"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js" type="text/javascript"
    <script src="/js/jquery.tinycarousel.min.js" type="text/javascript" charset="utf-8"></script>

    <title><?php echo CHtml::encode($this->pageTitle); ?></title>

</head>

<body>
<div id="container">
    <div id="body">
        <div class="lr_banner">
            <div id="left_banner">
                <?php
/*                                            if (isset($_COOKIE["users_resolution"])) {
                $screen_res = $_COOKIE["users_resolution"];
                print $screen_res;
            } else {
                print 'hello';
            }*/

                if (Yii::app()->user->isAdmin()) {
                    $this->widget('YumAdminMenu');
                } else if (!Yii::app()->user->isGuest) {
                    if (Yii::app()->controller->getId() === 'post') {

                        $this->widget('UserMenu');
                    } else {
                        $this->widget('YumUserMenu');
                    }
                } else {
                    $this->widget('LocationMenu');
                }
                ?>
            </div>
        </div>
        <div id="page">
            <div id="contact_btn">
                <a href="#" id="rss_btn"><img title="Rss" alt="Rss"
                                              src="<?php echo Yii::app()->request->baseUrl; ?>/images/rss_icon.png"
                                              height="36"/></a>
                <a href="#" id="help_btn"><img title="Help" alt="Help"
                                               src="<?php echo Yii::app()->request->baseUrl; ?>/images/help_icon.png"
                                               height="36"/></a>
            </div>
            <!--main menu-->
            <div id="main_menu">
                <?php include("MainMenu.php"); ?>
            </div>
            <!--Main Banner-->
            <div id="main_banner">
                <img src="/images/banner.jpg" alt="banner"/>
            </div>
            <div id="context">
                <?php echo $content; ?>
            </div>

            <!--
       <div id="footer">
           Copyright &copy; <?php /*echo date('Y'); */?> by My Company.<br/>
            All Rights Reserved.<br/>
            <?php /*echo Yii::powered(); */?>
        </div>-->
            <!-- footer -->

        </div>
        <div class="lr_banner">
            <div id="right_banner">
                right banner
            </div>
        </div>
    </div>
</div>

<!-- page -->

<script type="text/javascript">
    var DelayArray = new Array();
    var mouse_on_menu = -1;

    $(function() {
        // help and RSS
        $("#contact_btn").children("a").hover(
                function() {
                    $(this).animate({
                                top: "-=23px",
                                width: "36px"
                            }, 500
                    );
                },
                function() {
                    $(this).animate({
                                top: "175px",
                                width: "54px"
                            }, 500
                    );
                }
        );

        // Main menu
        var allLi = $('ul.menu > li');
        allLi.mouseover(
                function() {
                    $(this).addClass('show_arrow');
                    mouse_on_menu = $(this).attr('id');
                }).mouseout(
                function() {
                    $(this).removeClass('show_arrow');
                    mouse_on_menu = -1;
                }).click(function() {

                    // close/clear old
                    allLi.removeClass('show_arrow').removeClass('act');
                    for (id in DelayArray) {
                        clearInterval(DelayArray[id]);
                    }
                    // open new
                    $(this).addClass('act');
                    mouse_on_menu = $(this).attr('id');
                    DelayArray[$(this).attr('id')] = setInterval(function() {
                        for (id in DelayArray) {
                            if (mouse_on_menu == -1 || id != mouse_on_menu) {
                                $('#' + id).removeClass('act').removeClass('show_arrow');
                                clearInterval(DelayArray[id]);
                            }
                        }
                    }, 100);
                });
        // разделяем большие числа по разрядам: 12345 -> 12 345
        var splitDigits = $('.split_digits');
        for (var i = 0, _len = splitDigits.length; i < _len; i++) {
            var regex = /(\d{4,})/;
            if (splitDigits[i].innerHTML) {
                var num = parseInt(regex.exec(splitDigits[i].innerHTML));
                if (!isNaN(num) && num > 999) {
                    var str = '' + num;
                    splitDigits[i].innerHTML = splitDigits[i].innerHTML.replace(str, Math.floor(str / 1000) + ' ' + str.substring(str.length - 4, str.length - 1));
                }
            }
        }
    });
</script>
</body>

</html>